﻿using System;
using System.Web;

namespace Arbalest.Web.HttpModules
{
    public class ArbalestUserIdentityModule : IHttpModule
    {
        /// <summary>
        /// Walkthrough: Creating and Registering a Custom HTTP Module
        /// Reference: http://msdn.microsoft.com/en-us/library/ms227673(v=vs.100).aspx
        /// </summary>
        #region IHttpModule Members

        public void Dispose()
        {
            //clean-up code here.
        }

        public void Init(HttpApplication context)
        {
            #region comment out
            // Below is an example of how you can handle LogRequest event and provide 
            // custom logging implementation for it
            //context.LogRequest += new EventHandler(OnLogRequest);
            #endregion comment out

            context.AuthenticateRequest += (sender, e) =>
            {
                //using (System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\temp\\test.log", true))
                //{
                //    sw.AutoFlush = true;
                //    sw.WriteLine("AuthenticateRequest at " + DateTime.Now.ToString());
                //}
            };
        }

        #endregion

        #region comment out
        //public void OnLogRequest(Object source, EventArgs e)
        //{
        //    //custom logging logic can go here
        //}
        #endregion comment out
    }
}
